//
// Created by 11510 on 2024/6/14.
//

#ifndef SSO_STRINGBUFFER_H
#define SSO_STRINGBUFFER_H
#include <iostream>
using std::cout;
using std::endl;
using std::ostream;
using std::cerr;
class StringBuffer {
private:
    union Buffer{
        char * _pointer = nullptr;
        char _local[16];
    };

    size_t _size;
    size_t _capacity;
    Buffer _buffer;

public:
    explicit StringBuffer(const char * pstr);
    ~StringBuffer();
    char & operator[](size_t idx);
    friend ostream & operator<<(ostream & os,const StringBuffer & rhs);
};
ostream & operator<<(ostream & os,const StringBuffer & rhs);


#endif //SSO_STRINGBUFFER_H
